package org.shijiagen.clients;

import org.shijiagen.param.PageParam;
import org.shijiagen.param.ProductHotParam;
import org.shijiagen.pojo.Category;
import org.shijiagen.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 类别远程调用接口
 */
@FeignClient(name = "category-service",url = "http://localhost:3005")
public interface CategoryClient {

    @GetMapping("category/promo/{categoryName}")
    R byName(@PathVariable String categoryName);

    @PostMapping("category/hots")
    R hotsCategory(@RequestBody @Validated ProductHotParam productHotParam);

    @GetMapping("category/list")
    R list();

    @PostMapping("category/admin/list")
    R listPage(@RequestBody PageParam param);

    @PostMapping("category/admin/save")
    R save(@RequestBody Category category);

    @PostMapping("category/admin/remove")
    R remove(@RequestBody Integer categoryId);

    @PostMapping("category/admin/update")
    R update(@RequestBody Category category);
}
